<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/sql/models/qsqlrelationaldelegate.cpp -->
<head>
  <title>Qt 4.3: QSqlRelationalDelegate Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QSqlRelationalDelegate Class Reference<br /><sup><sup>[<a href="qtsql.html">QtSql</a> module]</sup></sup></h1>
<p>The QSqlRelationalDelegate class provides a delegate that is used to display and edit data from a <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a>. <a href="#details">More...</a></p>
<pre> #include &lt;QSqlRelationalDelegate&gt;</pre><p>Inherits <a href="qitemdelegate.html">QItemDelegate</a>.</p>
<ul>
<li><a href="qsqlrelationaldelegate-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qsqlrelationaldelegate.html#QSqlRelationalDelegate">QSqlRelationalDelegate</a></b> ( QObject * <i>parent</i> = 0 )</li>
<li><div class="fn"/><b><a href="qsqlrelationaldelegate.html#dtor.QSqlRelationalDelegate">~QSqlRelationalDelegate</a></b> ()</li>
</ul>
<ul>
<li><div class="fn"/>10 public functions inherited from <a href="qitemdelegate.html#public-functions">QItemDelegate</a></li>
<li><div class="fn"/>7 public functions inherited from <a href="qabstractitemdelegate.html#public-functions">QAbstractItemDelegate</a></li>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>1 property inherited from <a href="qitemdelegate.html#properties">QItemDelegate</a></li>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qabstractitemdelegate.html#public-slots">QAbstractItemDelegate</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"/>2 signals inherited from <a href="qabstractitemdelegate.html#signals">QAbstractItemDelegate</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>6 protected functions inherited from <a href="qitemdelegate.html#protected-functions">QItemDelegate</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QSqlRelationalDelegate class provides a delegate that is used to display and edit data from a <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a>.</p>
<p>Unlike the default delegate, QSqlRelationalDelegate provides a combobox for fields that are foreign keys into other tables. To use the class, simply call <a href="qabstractitemview.html#setItemDelegate">QAbstractItemView::setItemDelegate</a>() on the view with an instance of QSqlRelationalDelegate:</p>
<pre>     QTableView *view = new QTableView;
     view-&gt;setModel(model);
     view-&gt;setItemDelegate(new QSqlRelationalDelegate(view));</pre>
<p>The <a href="sql-relationaltablemodel.html">Relational Table Model</a> example (shown below) illustrates how to use QSqlRelationalDelegate in conjunction with <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a> to provide tables with foreign key support.</p>
<p align="center"><img src="images/relationaltable.png" /></p><p>See also <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a> and <a href="model-view-programming.html">Model/View Programming</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QSqlRelationalDelegate"></a>QSqlRelationalDelegate::QSqlRelationalDelegate ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a <a href="qsqlrelationaldelegate.html">QSqlRelationalDelegate</a> object with the given <i>parent</i>.</p>
<h3 class="fn"><a name="dtor.QSqlRelationalDelegate"></a>QSqlRelationalDelegate::~QSqlRelationalDelegate ()</h3>
<p>Destroys the <a href="qsqlrelationaldelegate.html">QSqlRelationalDelegate</a> object and frees any allocated resources.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
